package laboratoryQ.ui;

import java.awt.Graphics;
import javax.swing.JComponent;

import laboratoryQ.ui.draw.IDrawer;
import laboratoryQ.ui.draw.style.ChainStylizerStylizer;
import laboratoryQ.ui.draw.style.IStylizer;

@SuppressWarnings("serial")
public class DrawingJComponent extends JComponent {
	private IDrawer drawer;
	private IStylizer stylizer = ChainStylizerStylizer.EMPTY_INSTANCE;

	public DrawingJComponent(IDrawer drawer) {
		this.drawer = drawer;
	}

	public void setStylizer(IStylizer stylizer) {
		this.stylizer = stylizer;
	}

	public void setDrawer(IDrawer drawer) {
		this.drawer = drawer;
	}

	public IDrawer getDrawer() {
		return drawer;
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		drawer.draw(g, stylizer);
	}
}
